{{--前台列表页--}}
@extends('default.layouts.indexPublic')
@section('title'){{$partTimeSearch.Site::get('area_name').'兼职网|'.Site::get('area_name').'找兼职|最新兼职招聘|'.Site::get('webname')}} @endsection
{{--兼职列表页css--}}
@section('headcss')
    <meta name="keywords" content="{{Site::get('homekeywords')}}">
    <meta name="description" content="{{Site::get('homedescription')}}">
    @parent
    <link rel="stylesheet" href="{{asset('/default/css/part_time/index.css')}}">
@endsection

{{--主体内容--}}
@section('content')
    {{--logo、搜索栏--}}
    <div class="logoAndSearch">
        <div class="wrapper">
            <h1 class="logo">
                <a href="{{url('/')}}">
                    <img src="{{asset('/default/images/logo/jz_logo.png')}}">
                </a>
            </h1>
            <form class="search" action="{{url('jianzhi')}}" method="post">
                <div class="searchCont">
                    {!! csrf_field() !!}
                    <input type="text" name="keyword" id="keyword" value="{{$filterArray['keyword'] or ''}}" placeholder="请输入职位名或公司"/>
                    <button type="submit">搜索</button>
                </div>
            </form>
            <div class="publicJob"><a href="{{url('company/pt_create')}}" target="_blank">发布兼职</a></div>
        </div>
    </div>
    {{--logo、搜索栏结束--}}
    {{--筛选、职位列表以及侧边下载框结束--}}
    <div class="main">
        <div class="wrapper">
            {{--筛选栏--}}
            <div class="filter">
                <ul>
                    <li class="classes">
                        <span>兼职类型:</span>
                        <div class="cont">
                            <a href="{{url('jianzhi?keyword='.$filterArray['keyword'].'&type_id='.'&city_id='.$filterArray['city_id'].'&salary_method='.$filterArray['salary_method'])}}" class="@if($filterArray['type_id']==0){!! 'selected' !!}@endif">不限</a>
                            @foreach($typeList as $key => $value)
                                @if($key < 10)
                                    @if($filterArray['type_id'] !== 0 && $filterArray['type_id'] == $value['value'])
                                        <a href="{{url('jianzhi?keyword='.$filterArray['keyword'].'&type_id='.$value['value'].'&city_id='.$filterArray['city_id'].'&salary_method='.$filterArray['salary_method'])}}" class="selected">{{$value['text']}}</a>
                                    @else
                                        <a href="{{url('jianzhi?keyword='.$filterArray['keyword'].'&type_id='.$value['value'].'&city_id='.$filterArray['city_id'].'&salary_method='.$filterArray['salary_method'])}}">{{$value['text']}}</a>
                                    @endif
                                @endif
                            @endforeach
                        </div>
                        <div class="moreBtn"><span>更多类型</span><i></i></div>
                        <div class="cont moreClasses hide">
                            @foreach($typeList as $key => $value)
                                @if($key >= 10)
                                    @if($filterArray['type_id'] !== 0 && $filterArray['type_id'] == $value['value'])
                                        <input type="hidden" id="moreTypeActive" value="1">
                                        <a href="{{url('jianzhi?keyword='.$filterArray['keyword'].'&type_id='.$value['value'].'&city_id='.$filterArray['city_id'].'&salary_method='.$filterArray['salary_method'])}}" class="selected">{{$value['text']}}</a>
                                    @else
                                        <a href="{{url('jianzhi?keyword='.$filterArray['keyword'].'&type_id='.$value['value'].'&city_id='.$filterArray['city_id'].'&salary_method='.$filterArray['salary_method'])}}">{{$value['text']}}</a>
                                    @endif
                                @endif
                            @endforeach
                        </div>
                    </li>
                    <li class="workPlace">
                        <span>工作地点:</span>
                        <div class="cont">
                            <a href="{{url('jianzhi?keyword='.$filterArray['keyword'].'&type_id='.$filterArray['type_id'].'&city_id='.'&salary_method='.$filterArray['salary_method'])}}" class="@if($filterArray['city_id']==''){!! 'selected' !!}@endif">不限</a>
                            @foreach($cityList as $key => $value)
                                <a href="{{url('jianzhi?keyword='.$filterArray['keyword'].'&type_id='.$filterArray['type_id'].'&city_id='.$value['value'].'&salary_method='.$filterArray['salary_method'])}}" class="@if($filterArray['city_id']==$value['value']){!! 'selected' !!}@endif">{{$value['text']}}</a>
                            @endforeach
                        </div>
                    </li>
                    <li class="salary">
                        <span>结算方式:</span>
                        <div class="cont">
                            <a href="{{url('jianzhi?keyword='.$filterArray['keyword'].'&type_id='.$filterArray['type_id'].'&city_id='.$filterArray['city_id'].'&salary_method=')}}" class="@if($filterArray['salary_method']==0){!! 'selected' !!}@endif">不限</a>
                            <a href="{{url('jianzhi?keyword='.$filterArray['keyword'].'&type_id='.$filterArray['type_id'].'&city_id='.$filterArray['city_id'].'&salary_method=1')}}" class="@if($filterArray['salary_method']==1){!! 'selected' !!}@endif">日结</a>
                            <a href="{{url('jianzhi?keyword='.$filterArray['keyword'].'&type_id='.$filterArray['type_id'].'&city_id='.$filterArray['city_id'].'&salary_method=2')}}" class="@if($filterArray['salary_method']==2){!! 'selected' !!}@endif">周结</a>
                            <a href="{{url('jianzhi?keyword='.$filterArray['keyword'].'&type_id='.$filterArray['type_id'].'&city_id='.$filterArray['city_id'].'&salary_method=3')}}" class="@if($filterArray['salary_method']==3){!! 'selected' !!}@endif">月结</a>
                            <a href="{{url('jianzhi?keyword='.$filterArray['keyword'].'&type_id='.$filterArray['type_id'].'&city_id='.$filterArray['city_id'].'&salary_method=4')}}" class="@if($filterArray['salary_method']==4){!! 'selected' !!}@endif">完工结算</a>
                        </div>
                    </li>
                </ul>
            </div>
            {{--筛选栏结束--}}

            {{--职位列表--}}
            <div class="jobLists @if($app['person_ios'] == 0 && $app['person_android'] == 0)noAside @endif">
                <dl>
                    <dt>
                        <span class="jobName">兼职名称</span>
                        <span class="compName">公司名称</span>
                        <span class="address">工作地点</span>
                        <span class="salary">工资待遇</span>
                        <span class="settleMethod">结算方式</span>
                        <span class="date">时间</span>
                    </dt>
                    @if($jobLists->count() == 0)
                        <dd class="no-one">
                            <img src="{{ asset("/default/images/index/bgpic.jpg") }}">
                            <p>对不起,没有符合条件的记录!</p>
                        </dd>
                    @else
                        @foreach($jobLists as $key => $value)
                            <dd class="
                                @if($key%2 === 1)
                                    {!! 'hasBg' !!}
                                @endif
                            ">
                                <span class="jobName"><a href="{{url('jianzhi')}}_{{$value->id}}.html" target="_blank">{{str_limit($value->title,22)}}</a></span>
                                <span class="compName">{{str_limit($value->companyBasic->company_name,16)}}</span>
                                <span class="address">{{$value->area_name}}</span>
                                <span class="salary">{{$value->salary_price}}{{$value->salary_unit_name}}</span>
                                <span class="settleMethod">{{$value->salary_method_name}}</span>
                                <span class="date">{{timeTran($value->updated_at)}}</span>
                            </dd>
                        @endforeach
                    @endif
                </dl>
                <div class="pageList">
                    {!! $jobLists->links() !!}
                </div>
            </div>
            {{--职位列表结束--}}

            {{--右侧浮动框--}}
            <div class="rightAside">
                {{--下载二维码--}}
                @include('default.part_time.index.aside')
            </div>
            {{--右侧浮动框结束--}}
        </div>
    </div>
    {{--筛选、职位列表以及侧边下载框结束--}}
@endsection
{{--兼职列表页js--}}
@section('footerjs')
@parent
    <script type="text/javascript">
        //监听是否默认激活更多类型按钮
        $(document).ready(function () {
           var active = $('#moreTypeActive').attr('value');
           if (active == 1) {
               var _this = $('.filter .classes .moreBtn');
               activeMoreBtn(_this);
           }
        });

        //展开或者收起更多类型监听事件
        $(function (){
            //筛选栏更多类型按钮
            $('.filter .classes .moreBtn').click(function(){
                var _this = $(this);
                activeMoreBtn(_this);
           });
        });

        //展开或者收起更多类型操作
        function activeMoreBtn(obj) {
            //替换按钮文本与样式
            if(obj.children('span').html() == '更多类型'){
                obj.children('span').html('收起');
            }else{
                obj.children('span').html('更多类型');
            }
            //更多类型内容显示与隐藏
            obj.toggleClass('active').next().toggleClass('hide');
        }
    </script>
@endsection